package tmhm.shemes;

import java.awt.Point;
import java.util.ArrayList;

import tmhm.components.*;
import tmhm.gui.*;


public class Intr1 {

    private static RSFF PRINS, PRCOD, PRADR, PRINM;
    private static RSFF PRINTR1, PRINTR2, PRINTR3, PRINTR4, PRINTR5, PRINTR6, PRINTR7;
    private static REG IMR;
    private static IntToBools IMRBits;
    private static TSB TSBIMRout2;
    private static DC DC1;
    private static OR ORprekid;
    private static AND ANDprekid;
    private static NOT NOTprekid;
    private static GuiScheme gui;

    public static GuiScheme getGui() {
        return gui;
    }

    public static void init() {

        PRINS = new RSFF("PRINS");
        PRINS.setPinE(new Pin(true));
        PRINS.setPinClear(new Pin(false));

        PRCOD = new RSFF("PRCOD");
        PRCOD.setPinE(new Pin(true));
        PRCOD.setPinClear(new Pin(false));

        PRADR = new RSFF("PRADR");
        PRADR.setPinE(new Pin(true));
        PRADR.setPinClear(new Pin(false));

        PRINM = new RSFF("PRINM");
        PRINM.setPinE(new Pin(true));
        PRINM.setPinClear(new Pin(false));

        PRINTR1 = new RSFF("PRINTR1");
        PRINTR1.setPinE(new Pin(true));
        PRINTR1.setPinClear(new Pin(false));

        PRINTR2 = new RSFF("PRINTR2");
        PRINTR2.setPinE(new Pin(true));
        PRINTR2.setPinClear(new Pin(false));

        PRINTR3 = new RSFF("PRINTR3");
        PRINTR3.setPinE(new Pin(true));
        PRINTR3.setPinClear(new Pin(false));

        PRINTR4 = new RSFF("PRINTR4");
        PRINTR4.setPinE(new Pin(true));
        PRINTR4.setPinClear(new Pin(false));

        PRINTR5 = new RSFF("PRINTR5");
        PRINTR5.setPinE(new Pin(true));
        PRINTR5.setPinClear(new Pin(false));

        PRINTR6 = new RSFF("PRINTR6");
        PRINTR6.setPinE(new Pin(true));
        PRINTR6.setPinClear(new Pin(false));

        PRINTR7 = new RSFF("PRINTR7");
        PRINTR7.setPinE(new Pin(true));
        PRINTR7.setPinClear(new Pin(false));

        IMR = new REG(1, "IMR");
        IMR.getOut(0).setIsInt();
        IMR.getOut(0).setNumOfLines(16);
        IMR.initVal(0xff); // DOZVOLI MASKIRAJUCE SVE PREKIDE

        IMRBits = new IntToBools(16, 16);

        TSBIMRout2 = new TSB();
        TSBIMRout2.getOut(0).setNumOfLines(16);

        ORprekid = new OR(6);
        NOTprekid = new NOT();
        ANDprekid = new AND();

        DC1 = new DC(3);

    }

    public static void connect() {
        PRINS.setInputPin(0, Oper1.stPRINS());
        PRINS.setInputPin(1, Oper1.clPRINS());

        PRCOD.setInputPin(0, Oper1.stPRCOD());
        PRCOD.setInputPin(1, Oper1.clPRCOD());

        PRADR.setInputPin(0, Oper1.stPRADR());
        PRADR.setInputPin(1, Oper1.clPRADR());

        PRINM.setInputPin(0, new Pin(false));//OVDE ZAKACITI PIN SA FAULTA
        PRINM.setInputPin(1, Oper1.clPRINM());

        PRINTR1.setInputPin(0, new Pin(false));
        PRINTR1.setInputPin(1, DC1.getOut(1));

        PRINTR2.setInputPin(0, new Pin(false));
        PRINTR2.setInputPin(1, DC1.getOut(2));

        PRINTR3.setInputPin(0, new Pin(false));
        PRINTR3.setInputPin(1, DC1.getOut(3));

        PRINTR4.setInputPin(0, new Pin(false));
        PRINTR4.setInputPin(1, DC1.getOut(4));

        PRINTR5.setInputPin(0, new Pin(false));
        PRINTR5.setInputPin(1, DC1.getOut(5));

        PRINTR6.setInputPin(0, new Pin(false));
        PRINTR6.setInputPin(1, DC1.getOut(6));

        PRINTR7.setInputPin(0, new Pin(false));
        PRINTR7.setInputPin(1, DC1.getOut(7));

        IMR.setInputPin(0, Bus1.IBUS3());
        IMR.setPinLd(Oper1.ldIMR());

        IMRBits.setInputPin(0, IMR.getOut(0));

        TSBIMRout2.setInputPin(0, IMR.getOut(0));
        TSBIMRout2.setCtrl(Oper1.IMRout2());
        Bus1.addOnIBUS2(TSBIMRout2.getOut(0));

        NOTprekid.setInputPin(0, Fetch2.RTI());
        ANDprekid.setInputPin(0, Exec2.PSWT());
        ANDprekid.setInputPin(1, NOTprekid.getOut(0));

        ORprekid.setInputPin(0, PRINS.getOut(0));
        ORprekid.setInputPin(1, PRCOD.getOut(0));
        ORprekid.setInputPin(2, PRADR.getOut(0));
        ORprekid.setInputPin(3, PRINM.getOut(0));
        ORprekid.setInputPin(4, Intr2.printr());
        ORprekid.setInputPin(5, ANDprekid.getOut(0));

        DC1.setE(Oper1.clINTR());
        DC1.setInputPin(0, Intr2.prl0());
        DC1.setInputPin(1, Intr2.prl1());
        DC1.setInputPin(2, Intr2.prl2());
    }

    public static void gui() {
        GuiLine line; // Pomocna promenljiva
        gui = new GuiScheme("tmhm/tmhm/images/Intr1.png");

        ArrayList<ArrayList<Point>> sections;
        ArrayList<Point> points;


        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 51));
        points.add(new Point(123, 51));
        sections.add(points);
        line = new GuiLine(sections, Oper1.stPRINS());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 78));
        points.add(new Point(123, 78));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 104));
        points.add(new Point(123, 104));
        sections.add(points);
        line = new GuiLine(sections, Oper1.clPRINS());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(180, 51));
        points.add(new Point(187, 51));
        sections.add(points);
        line = new GuiLine(sections, PRINS.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(180, 104));
        points.add(new Point(187, 104));
        sections.add(points);
        line = new GuiLine(sections, PRINS.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(314, 51));
        points.add(new Point(322, 51));
        sections.add(points);
        line = new GuiLine(sections, Oper1.stPRCOD());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(314, 78));
        points.add(new Point(322, 78));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(314, 104));
        points.add(new Point(322, 104));
        sections.add(points);
        line = new GuiLine(sections, Oper1.clPRCOD());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 51));
        points.add(new Point(386, 51));
        sections.add(points);
        line = new GuiLine(sections, PRCOD.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 104));
        points.add(new Point(386, 104));
        sections.add(points);
        line = new GuiLine(sections, PRCOD.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(512, 51));
        points.add(new Point(520, 51));
        sections.add(points);
        line = new GuiLine(sections, Oper1.stPRADR());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(512, 78));
        points.add(new Point(520, 78));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(512, 104));
        points.add(new Point(520, 104));
        sections.add(points);
        line = new GuiLine(sections, Oper1.clPRADR());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(577, 51));
        points.add(new Point(584, 51));
        sections.add(points);
        line = new GuiLine(sections, PRADR.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(577, 104));
        points.add(new Point(584, 104));
        sections.add(points);
        line = new GuiLine(sections, PRADR.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 193));
        points.add(new Point(123, 193));
        sections.add(points);
        line = new GuiLine(sections, new Pin(false));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 219));
        points.add(new Point(123, 219));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 246));
        points.add(new Point(123, 246));
        sections.add(points);
        line = new GuiLine(sections, Oper1.clPRINM());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(180, 193));
        points.add(new Point(187, 193));
        sections.add(points);
        line = new GuiLine(sections, PRINM.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(180, 246));
        points.add(new Point(187, 246));
        sections.add(points);
        line = new GuiLine(sections, PRINM.getOut(1));
        gui.addLine(line);


sections=new ArrayList<ArrayList<Point>>();
points=new ArrayList<Point>();
points.add(new Point(601,141));
points.add(new Point(601,314));
sections.add(points);
line=new GuiLine(sections,Bus1.IBUS1());
gui.addLine(line);
sections=new ArrayList<ArrayList<Point>>();
points=new ArrayList<Point>();
points.add(new Point(583,154));
points.add(new Point(583,301));
sections.add(points);
line=new GuiLine(sections,Bus1.IBUS2());
gui.addLine(line);
sections=new ArrayList<ArrayList<Point>>();
points=new ArrayList<Point>();
points.add(new Point(565,167));
points.add(new Point(565,288));
sections.add(points);
line=new GuiLine(sections,Bus1.IBUS3());
gui.addLine(line);



sections=new ArrayList<ArrayList<Point>>();
points=new ArrayList<Point>();
points.add(new Point(297,223));
points.add(new Point(303,223));
sections.add(points);
line=new GuiLine(sections,Oper1.ldIMR());
gui.addLine(line);
sections=new ArrayList<ArrayList<Point>>();
points=new ArrayList<Point>();
points.add(new Point(447,223));
points.add(new Point(454,223));
sections.add(points);
line=new GuiLine(sections,LogicalComponent.getCPUCLK());
gui.addLine(line);
sections=new ArrayList<ArrayList<Point>>();
points=new ArrayList<Point>();
points.add(new Point(376,240));
points.add(new Point(376,262));
points.add(new Point(459,262));
sections.add(points);
line=new GuiLine(sections,IMR.getOut(0));
gui.addLine(line);
sections=new ArrayList<ArrayList<Point>>();
points=new ArrayList<Point>();
points.add(new Point(469,266));
points.add(new Point(469,272));
sections.add(points);
line=new GuiLine(sections,Oper1.IMRout2());
gui.addLine(line);
sections=new ArrayList<ArrayList<Point>>();
points=new ArrayList<Point>();
points.add(new Point(479,262));
points.add(new Point(583,262));
sections.add(points);
line=new GuiLine(sections,TSBIMRout2.getOut(0));
gui.addLine(line);
sections=new ArrayList<ArrayList<Point>>();
points=new ArrayList<Point>();
points.add(new Point(376,206));
points.add(new Point(376,186));
points.add(new Point(565,186));
sections.add(points);
line=new GuiLine(sections,Bus1.IBUS3());
gui.addLine(line);



        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 342));
        points.add(new Point(123, 342));
        sections.add(points);
        line = new GuiLine(sections, new Pin(false));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 369));
        points.add(new Point(123, 369));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 395));
        points.add(new Point(123, 395));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(3));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(180, 342));
        points.add(new Point(187, 342));
        sections.add(points);
        line = new GuiLine(sections, PRINTR3.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(180, 395));
        points.add(new Point(187, 395));
        sections.add(points);
        line = new GuiLine(sections, PRINTR3.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(314, 342));
        points.add(new Point(322, 342));
        sections.add(points);
        line = new GuiLine(sections, new Pin(false));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(314, 369));
        points.add(new Point(322, 369));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(314, 395));
        points.add(new Point(322, 395));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(2));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 342));
        points.add(new Point(386, 342));
        sections.add(points);
        line = new GuiLine(sections, PRINTR2.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 395));
        points.add(new Point(386, 395));
        sections.add(points);
        line = new GuiLine(sections, PRINTR2.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(511, 342));
        points.add(new Point(520, 342));
        sections.add(points);
        line = new GuiLine(sections, new Pin(false));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(512, 369));
        points.add(new Point(520, 369));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(512, 395));
        points.add(new Point(520, 395));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(577, 342));
        points.add(new Point(584, 342));
        sections.add(points);
        line = new GuiLine(sections, PRINTR1.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(577, 395));
        points.add(new Point(584, 395));
        sections.add(points);
        line = new GuiLine(sections, PRINTR1.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 455));
        points.add(new Point(123, 455));
        sections.add(points);
        line = new GuiLine(sections, new Pin(false));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 482));
        points.add(new Point(123, 482));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(116, 508));
        points.add(new Point(123, 508));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(6));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(180, 455));
        points.add(new Point(187, 455));
        sections.add(points);
        line = new GuiLine(sections, PRINTR6.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(180, 508));
        points.add(new Point(187, 508));
        sections.add(points);
        line = new GuiLine(sections, PRINTR6.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(314, 455));
        points.add(new Point(322, 455));
        sections.add(points);
        line = new GuiLine(sections, new Pin(false));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(314, 482));
        points.add(new Point(322, 482));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(314, 508));
        points.add(new Point(322, 508));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(5));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 455));
        points.add(new Point(386, 455));
        sections.add(points);
        line = new GuiLine(sections, PRINTR5.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 508));
        points.add(new Point(386, 508));
        sections.add(points);
        line = new GuiLine(sections, PRINTR5.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(511, 455));
        points.add(new Point(520, 455));
        sections.add(points);
        line = new GuiLine(sections, new Pin(false));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(512, 482));
        points.add(new Point(520, 482));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(512, 508));
        points.add(new Point(520, 508));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(4));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(577, 455));
        points.add(new Point(584, 455));
        sections.add(points);
        line = new GuiLine(sections, PRINTR4.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(577, 508));
        points.add(new Point(584, 508));
        sections.add(points);
        line = new GuiLine(sections, PRINTR4.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(165, 563));
        points.add(new Point(176, 563));
        points.add(new Point(176, 582));
        points.add(new Point(180, 582));
        sections.add(points);
        line = new GuiLine(sections, PRINS.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(165, 578));
        points.add(new Point(172, 578));
        points.add(new Point(172, 590));
        points.add(new Point(180, 590));
        sections.add(points);
        line = new GuiLine(sections, PRCOD.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(165, 593));
        points.add(new Point(169, 593));
        points.add(new Point(169, 597));
        points.add(new Point(182, 597));
        sections.add(points);
        line = new GuiLine(sections, PRADR.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(165, 608));
        points.add(new Point(169, 608));
        points.add(new Point(169, 605));
        points.add(new Point(182, 605));
        sections.add(points);
        line = new GuiLine(sections, PRINM.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(165, 624));
        points.add(new Point(172, 624));
        points.add(new Point(172, 612));
        points.add(new Point(180, 612));
        sections.add(points);
        line = new GuiLine(sections, Intr2.printr());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(135, 654));
        points.add(new Point(142, 654));
        sections.add(points);
        line = new GuiLine(sections, Exec2.PSWT());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(135, 665));
        points.add(new Point(142, 665));
        sections.add(points);
        line = new GuiLine(sections, NOTprekid.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(165, 659));
        points.add(new Point(176, 659));
        points.add(new Point(176, 620));
        points.add(new Point(180, 620));
        sections.add(points);
        line = new GuiLine(sections, ANDprekid.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(202, 601));
        points.add(new Point(210, 601));
        sections.add(points);
        line = new GuiLine(sections, ORprekid.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(352, 695));
        points.add(new Point(352, 688));
        sections.add(points);
        line = new GuiLine(sections, Oper1.clINTR());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(318, 635));
        points.add(new Point(325, 635));
        sections.add(points);
        line = new GuiLine(sections, Intr2.prl0());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(318, 620));
        points.add(new Point(325, 620));
        sections.add(points);
        line = new GuiLine(sections, Intr2.prl1());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(318, 605));
        points.add(new Point(325, 605));
        sections.add(points);
        line = new GuiLine(sections, Intr2.prl2());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 673));
        points.add(new Point(386, 673));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 658));
        points.add(new Point(386, 658));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(1));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(377, 642));
        points.add(new Point(386, 642));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(2));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 627));
        points.add(new Point(386, 627));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(3));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 612));
        points.add(new Point(386, 612));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(4));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 597));
        points.add(new Point(386, 597));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(5));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 582));
        points.add(new Point(386, 582));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(6));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(378, 567));
        points.add(new Point(386, 567));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(7));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(511, 569));
        points.add(new Point(520, 569));
        sections.add(points);
        line = new GuiLine(sections, new Pin(false));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(512, 595));
        points.add(new Point(520, 595));
        sections.add(points);
        line = new GuiLine(sections, LogicalComponent.getCPUCLK());
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(512, 622));
        points.add(new Point(520, 622));
        sections.add(points);
        line = new GuiLine(sections, DC1.getOut(7));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(577, 569));
        points.add(new Point(584, 569));
        sections.add(points);
        line = new GuiLine(sections, PRINTR7.getOut(0));
        gui.addLine(line);

        sections = new ArrayList<ArrayList<Point>>();
        points = new ArrayList<Point>();
        points.add(new Point(577, 622));
        points.add(new Point(584, 622));
        sections.add(points);
        line = new GuiLine(sections, PRINTR7.getOut(1));
        gui.addLine(line);

        // LABELE:
        gui.addLabel(new GuiLabel(605, 176, Bus1.IBUS1()));
        gui.addLabel(new GuiLabel(587, 206, Bus1.IBUS2()));
        gui.addLabel(new GuiLabel(569, 236, Bus1.IBUS3()));
        gui.addLabel(new GuiLabel(381, 279, IMR.getOut(0)));
        gui.addLabel(new GuiLabel(512, 258, TSBIMRout2.getOut(0)));

    }

    public static Pin prekid() {
        return ORprekid.getOut(0);
    }

    public static Pin PRINS() {
        return PRINS.getOut(0);
    }

    public static Pin PRCOD() {
        return PRCOD.getOut(0);
    }

    public static Pin PRADR() {
        return PRADR.getOut(0);
    }

    public static Pin PRINM() {
        return PRINM.getOut(0);
    }

    public static Pin PRINTR1() {
        return PRINTR1.getOut(0);
    }

    public static Pin PRINTR2() {
        return PRINTR2.getOut(0);
    }

    public static Pin PRINTR3() {
        return PRINTR3.getOut(0);
    }

    public static Pin PRINTR4() {
        return PRINTR4.getOut(0);
    }

    public static Pin PRINTR5() {
        return PRINTR5.getOut(0);
    }

    public static Pin PRINTR6() {
        return PRINTR6.getOut(0);
    }

    public static Pin PRINTR7() {
        return PRINTR7.getOut(0);
    }

    public static Pin IMR1() {
        return IMRBits.getOut(1);
    }

    public static Pin IMR2() {
        return IMRBits.getOut(2);
    }

    public static Pin IMR3() {
        return IMRBits.getOut(3);
    }

    public static Pin IMR4() {
        return IMRBits.getOut(4);
    }

    public static Pin IMR5() {
        return IMRBits.getOut(5);
    }

    public static Pin IMR6() {
        return IMRBits.getOut(6);
    }

    public static Pin IMR7() {
        return IMRBits.getOut(7);
    }

    public static Pin IMR() {
        return IMR.getOut(0);
    }

    public static REG RegIMR() {
        return IMR;
    }
}
